package com.lanou.shunke.article.web.controller;

import com.lanou.shunke.article.entity.Article;
import com.lanou.shunke.article.service.ArticleService;
import com.lanou.shunke.common.entity.ShunkeResult;
import com.lanou.shunke.common.utils.ShunkeResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @GetMapping("/list")
    public ShunkeResult list() {
        List<Article> articles = articleService.findAll();
        return ShunkeResultUtils.success(articles);
    }
}
